package pzl.com.drawrelated.views;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.View;

/**
 * @author zl.peng
 */
public class V4 extends View {
    Paint paint;

    public V4(Context context) {
        this(context, null);
    }

    public V4(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
        paint = new Paint();
        paint.setStrokeWidth(40);
        paint.setStyle(Paint.Style.STROKE);
        paint.setAntiAlias(true);
        paint.setStrokeCap(Paint.Cap.ROUND);
    }

    public V4(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    }

    @Override
    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
        super.onLayout(changed, left, top, right, bottom);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        RectF r = new RectF();
        r.left = 0;
        r.right = getHeight() / 2;
        r.top = 0;
        r.bottom = getHeight() / 2;
        canvas.drawArc(r, 0f, 270f, true, paint);
        r.bottom = getHeight();
        r.top = getHeight() / 2;
        canvas.drawArc(r, 0f, 270f, false, paint);
    }


}
